package jwlee.testproxy.dynproxy;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class TestAop {
	public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException {

        //通过ApplicationContext获取配置文档

		ApplicationContext actx=new ClassPathXmlApplicationContext("jwlee/testproxy/dynproxy/proxybeanconfig.xml");  
		//ApplicationContext actx=new FileSystemXmlApplicationContext("config.xml"); 

        LogicInterface logic = (LogicInterface)actx.getBean("logic1Proxy");

        //模拟执行新增、修改、删除方法
		try {
			logic.doDelete("王五");

			logic.doInsert("张三");

			logic.doUpdate("李四====");
		} catch (Exception ex) {
			ex.printStackTrace();
        }
        
        
//        Logic2 logic2 = (Logic2)actx.getBean("logic2Proxy");
//
//        //模拟执行新增、修改和删除方法
//
//        try {
//
//                 logic2.doInsert("张三");
//
//                 logic2.doUpdate("李四");
//
//                 logic2.doDelete("王五");
//
//        } catch (Exception ex) {
//
//                 
//
//        }



}


}
